// ==UserScript==
// @name         Auto Exam
// @namespace    http://tampermonkey.net/
// @version      0.0.2
// @description  try to take over the world!
// @author       Le
// @match        http://gpzx.cei.cn/examAdmin/gotoExam.do*
// @updateURL    https://gitee.com/clearlove123/video/raw/master/autoExam.user.js
// @icon         
// @grant        none
// ==/UserScript==


(function () {
    /* 查看所有答案
    $("li").each((index, a) => {
        if ("judge-question exam-question-unit" === a.parentNode.parentNode.className)
            console.log(a.innerText)
    })
    * */
    //每道题的分组li：$(".exam-question-box")[0].getElementsByTagName("li")
    //题目：分组.children[0].innerText
    //选项：分组.getElementsByTagName("label")
    // 判断：
    let answer = [1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 3, 3, 0, 3, 2, 2, 1, 3, 2, 1, 0, 3, 1, 1, 0, 0, 2, 2, 2, 1, 2, 1, 3, 3];
    $("li").each((index, a) => {
        if ("judge-question exam-question-unit" === a.parentNode.parentNode.className) {
            a.getElementsByTagName("label")[answer[index]].click();
        }
    })
    console.log("半小时后交卷\n" + new Date());
    setTimeout(() => {
        console.log("点击确认交卷");
        $(".exam-commit")[0].click();
    }, 30 * 60 * 1000);
    setTimeout(() => {
        console.log("点击是");
        $(".btn.btn-info:contains('是')").each((index, a) => {
            if ("subModal" === a.parentNode.parentNode.parentNode.parentNode.id) {
                a.click();
            }
        })
    }, (30 * 60 + 5) * 1000)
})();
